'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    /**
     * Add altering commands here.
     *
     * Example:
     * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
     */
    const { INTEGER, STRING, DATE } = Sequelize;
    await queryInterface.createTable('sys_logininfor', {
      info_id: {
        type: INTEGER(20),
        comment: "参数主键",
        allowNull: false,
        primaryKey: true,
        autoIncrement: true
      },
      user_name: {
        type: STRING(50),
        comment: "",
        defaultValue: ""
      },
      ipaddr: {
        type: STRING(128),
        comment: "",
        defaultValue: ""
      },
      login_location: {
        type: STRING,
        comment: "",
        defaultValue: ""
      },
      browser: {
        type: STRING(50),
        comment: "",
        defaultValue: ""
      },
      os: {
        type: STRING(50),
        comment: "",
        defaultValue: ""
      },
      status: {
        type: STRING(1),
        comment: "",
        defaultValue: ""
      },
      msg: {
        type: STRING,
        comment: "",
        defaultValue: ""
      },
      created_at: {
        type: DATE,
        comment: "创建时间",
      },
      updated_at: {
        type: DATE,
        comment: "更新时间",
      },
      deleted_at: {
        type: DATE,
        comment: "删除时间",
      }
    });
  },

  down: async (queryInterface, Sequelize) => {
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
  }
};
